Skip to content

Test quote, trim, trimLower and isBlank directly - #10

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/test-string-helpers
Oct 18, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
feature/test-string-helpers

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B (unit-test expansion) cycle: direct tests are added for the trace_client::detail string helpers that had none of their own.

  • quoteEscapesWhatJsonRequiresAndPassesTheRestThrough — detail::quote was only reached through detail::json, which never exercised the \b, \f and \r escapes, the \u00XX form for NUL / VT / 0x1F, or DEL, / and UTF-8 passing through unescaped. An all-256-bytes sweep asserts that no raw control character reaches the body.
  • trimmingTreatsEveryAsciiSpaceAlike — detail::trim, detail::trimLower and detail::isBlank decide the environment opt-out, blank keys/names and the trimmed version tag, and had no direct test. Every ASCII space is shown to be trimmed alike, only ASCII letters to be folded, and a no-break space (U+00A0) to be non-blank.

These are characterization tests only: trace_client.hpp is unchanged, and every assertion matches the current behavior.

No tracking issue. The gap was found during triage by checking every detail:: function for a direct test in test/test_trace_client.cpp.

Skipped issue: #1 (Windows ignores TRACE_CLIENT_CURL when System32\curl.exe exists) is waiting for an owner decision between honoring the override and documenting the current behavior, so it was not picked.

Test plan

  • make test (g++, C++11, -Werror): 46 tests, 0 failed checks (up from 44)
  • make test STD=c++17: 46 tests, 0 failed checks
  • CI Build matrix (linux g++/clang++ × 11/17/20, libcurl, sanitizers, macOS, Windows/MSVC) green

This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).

🤖 Generated with Claude Code


drafted by Claude on behalf of Daniel Stephenson

quote was only reached through json, which never exercised the \b, \f
and \r escapes, \u00XX for NUL/VT/0x1F, or DEL and UTF-8 passing through
unescaped. The trimming helpers decide the environment opt-out, blank
keys and the version tag, and had no test of their own.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@dmccoystephenson

Copy link
Copy Markdown
Member Author

Self-review rubric (anchored on CI run 39120516362 and the local make test output):

  • Scope: PASS — only test/test_trace_client.cpp is modified (+38 lines); trace_client.hpp is untouched.
  • Tests-new: PASS — no new public functions; the two new tests target the existing detail::quote, detail::trim, detail::trimLower and detail::isBlank, which previously had no direct test.
  • Tests-fix: N/A — no bug fix; these are characterization tests that assert current behavior.
  • Sibling structure: PASS — both tests follow the neighboring style (static void sentence names, using trace_client::detail::..., CHECK/CHECK_EQ, an all-bytes sweep mirroring curlQuoteKeepsEveryValueOnOneConfigLine).
  • Sibling renames: N/A — nothing renamed.
  • Docs: PASS — no behavior change, so no README row or header comment is affected.
  • Issue resolution: N/A — no Closes; the gap was found at triage.
  • CI: PASS — all 11 jobs green on the head SHA (linux g++/clang++ × c++11/17/20, linux-libcurl, sanitizers thread + address,undefined, macos, windows).
  • Registered: PASS — each new name appears twice in the file (definition plus tests[] entry); the run printed 46 tests, 0 failed checks, up from 44.
  • C++11: PASS — make test (default STD=c++11, -Werror) was clean locally, and both c++11 CI legs are green.
  • No new dependency / Never throws / Curl argv fixed / Version triple: N/A — no change to the header, Makefile or CMakeLists.txt.
  • Sanitizers: PASS — both linux-sanitizers jobs are green.

Observations (judgment calls, not blocking):

  • test/test_trace_client.cpp — the trimLower non-ASCII assertion relies on std::tolower running in the "C" locale. That holds because main() never calls setlocale, and the CommaDecimal test installs an unnamed std::locale, which does not change the C locale. The assertion passed on MSVC too.
  • Out of diff, trace_client.hpp:1116-1123 — TraceClient::start trims application and key with " \t\r\n" only, while isBlank uses std::isspace (which also covers \v/\f). It is harmless (headerSafe and quote neutralize the extra bytes) and is noted here only for awareness.

This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit 7bfc597 into main Oct 18, 2026
11 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/test-string-helpers branch October 18, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant